<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<script src="js/jquery.js"></script>
<script src="js/jquery.multiSelect-1.2.3/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="js/jquery.multiSelect-1.2.3/jquery.multiSelect.js" type="text/javascript"></script>
<link href="js/jquery.multiSelect-1.2.3/jquery.multiSelect.css" rel="stylesheet" type="text/css" />

<title>回访管理</title>

<script type="text/javascript">
	$(document).ready( function() {
		$("#selDep").multiSelect({
			selectAll: false,
	        noneSelected: '选择科室',
	        oneOrMoreSelected: '*'});
		$("#selStatus").multiSelect({
			selectAll: false,
	        noneSelected: '选择回访状态',
	        oneOrMoreSelected: '*'});
	});
</script>
</head>

<body>
	<div id="wrap">
    	<div id="public_head"></div>
        <div class="m_search">
        	<form method="get" action="" name="">
        	<input type="hidden" name="c" value="visitzy" />
        	<input type="hidden" name="a" value="index" />
        	时间范围 <input name="startTime" class="Wdate" value="<?php echo $startTime?>" type="text" onclick="WdatePicker();"/> > <input name="endTime" value="<?php echo $endTime?>" class="Wdate" type="text" onClick="WdatePicker()"/> 
        	<select id="selStatus" class="select" name="selStatus" multiple="multiple">
        	<?php 
        	$visitStatus = ATools::getConfig('app.visitStatus');
        	foreach ($visitStatus as $key=>$name) {
        		$selected = ($selStatus and in_array("'$key'", $selStatus)) ?  ' selected' : '';
        		echo "<option value=\"{$key}\"{$selected}>{$name}</option>";
        	}
        	?>
        	</select>
        	<select id="selDep" class="select" name="selDep" multiple="multiple">
        	<?php 
        	foreach ($depts as $dep) {
        		$selected = ($selDep and in_array($dep['DEP_NO'], $selDep)) ?  ' selected' : '';
        		echo "<option value=\"{$dep['DEP_NO']}\"{$selected}>{$dep['DEP_NAME']}</option>";
        	}
        	?>
        	</select> 
        	<input class="qi_text" name="keyword" type="text" value="<?php echo $keyword?$keyword : '输入医生或客户'?>"/> 
        	<input class="btn_search" name="search" type="submit" value="" />
        	</form>
        </div>
        <div class="m_search">
        	本次搜索查询共有&nbsp;<span class="red"><b><?php echo $totalCount?></b></span> 人，其中已回访 <span class="red"><b><?php echo $yetAccess?></b></span> 人，未回访 <span class="red"><b><?php echo $unAccess?></b></span> 人，成功 <span class="red"><b><?php echo $sucAccess?></b></span> 人，需再次回访 <span class="red"><b><?php echo $againAccess?></b></span> 人，失败 <span class="red"><b><?php echo $failAccess?></b></span> 人
        	&nbsp;
        	成功率&nbsp;<span class="red"><b>
			<?php
				if($yetAccess == 0){
					echo '0';
				}else{
					echo number_format($sucAccess/$yetAccess,4)*100;
				}
			?></b>%</span>
        	<!--<input type='button' style='cursor:pointer;' value='详 情' onclick="JYCsm.openvisitinfo();"/>
        --></div>
        <div class="m_content">
        	<table class="qi_table" width="0" border="0" cellpadding="0" cellspacing="1">
              <tr><th>患者姓名</th><th>联系电话</th><th >年龄</th><th >性别</th><th>入院时间</th><th>出院时间</th><th>科室</th><th>医生</th><th>回访状态</th><th >操作</th></tr>
            <?php 
            $p = $startNum;
            foreach ($rows as $row) {
            	?>
            <tr><td><?php echo str_replace($keyword, '<font color="red"><b>'.$keyword.'</b></font>', $row['TRUE_NAME'])?></td><td><?php echo $row['PHONE']?></td><td ><?php echo ATools::getAge($row['BIRTH'])?></td><td ><?php echo $row['SEX']?></td><td><?php echo $row['RY_DATE']?></td><td><?php echo $row['CY_DATE']?></td><td><?php echo $row['CY_DEP']?></td><td><?php echo str_replace($keyword, '<font color="red"><b>'.$keyword.'</b></font>', $row['ZYDOC'])?></td><td><?php echo ATools::getVisitStatus($row['VISIT_STATE'])?></td>
            <td >
            	<?php 
            		if(empty($row['VISIT_STATE']) || in_array($row['VISIT_STATE'],array('A','C','G','H','I'))){
            	?>
            		<a href="?c=visitzy&a=entry&p=<?php echo $p?>"><font color="orange"><b>回访</b></font></a>
            	<?php 
            		}else{
            	?>
            		<a href="?c=visitzy&a=entry&p=<?php echo $p?>"><font color="gray">详情</font></a>
            	<?php }?>
            </td></tr>
            <?php $p += 1;}?>
              <tr><td colspan="10"><?php echo $pager?><div class="clear"></div></td></tr>
            </table>
        </div>
    </div>
</body>
</html>
<script src="/js/add_public_head.js" type="text/javascript"></script>
<script src="js/artDialog/jquery.artDialog.js?skin=chrome"></script>
<script src="js/artDialog/plugins/iframeTools.source.js"></script>
<script src="js/comm.js" type="text/javascript"></script>
<script type="text/javascript">
$('input.btn_search').click(function(){
	if($('input[name="keyword"]').val()=='输入医生或客户'){
		$('input[name="keyword"]').val('')
	}
})
$('input[name="startTime"]').blur(function(){
	var time = $(this).val()
	if($('input[name="endTime"]').val()==''){
		$('input[name="endTime"]').val(time)
	}
})
$('input[name="keyword"]').bind({
	focus:(function(){
		var val = $(this).val();
		if(val == '输入医生或客户'){
			$(this).val('')
		}
	}),
	blur:(function(){
		var val = $(this).val();
		if(val == ''){
			$(this).val('输入医生或客户')
		}
	})
})
$('#selDep').width('106px')
$('#selStatus').width('80px')
</script>